package E2020;

public class Exam3_3 implements Runnable {
        int number =1;
        @Override
        public void run() {
            for(int j =1;j<=5;j++) {
                // number++;
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName()+"：" +number++);
            }
        }

        public static void main(String[] args) {
            Exam3_3 exam = new Exam3_3();
            for (int j = 1; j <=3; j++) {
                for(int i =1; i<=3;i++) {
                    Thread thread = new Thread(exam);
                    thread.setName("线程"+i);
                    thread.start();
                    try {
                        thread.join();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
